import 'package:flutter/material.dart';
import 'package:flutter_chip/config/Comm.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

class CommWidget {
  static Widget nullWidget({String msg}) {
    return Container(
        alignment: Alignment.center,
        child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
          Image.asset(Comm.IMG_NO_DATA,
              width: 200, height: 128, fit: BoxFit.fill),
          Text(null != msg ? msg : "没有符合条件的数据",
              style: TextStyle(color: Color(0xffBBBBBB), fontSize: 16))
        ]));
  }

  static Widget imgError({double textSize = 14}) {
    return Container(
      color: Color(0xffBBBBBB),
      height: 40,
      padding: EdgeInsets.all(4),
      alignment: Alignment.center,
      child: Text(
        "图片跑路了~",
        textAlign: TextAlign.center,
        style: TextStyle(color: Color(0xff999999), fontSize: textSize),
      ),
    );
  }

  static ClassicalHeader commHeader() {
    return ClassicalHeader(
        refreshText: "下拉可刷新",
        refreshReadyText: "释放立即刷新",
        refreshingText: "正在刷新...",
        refreshedText: "刷新完成",
        infoText: "上次更新%T",
        noMoreText: "没有更多",
        textColor: Colors.grey,
        infoColor: Colors.grey);
  }

  static ClassicalFooter commFooter() {
    return ClassicalFooter(
        loadText: "下拉可刷新",
        loadReadyText: "释放立即刷新",
        loadingText: "加载中...",
        loadedText: "加载完成",
        loadFailedText: "请求失败，请重试",
        infoText: "上次更新%T",
        noMoreText: "已加载全部数据",
        textColor: Colors.grey,
        infoColor: Colors.grey);
  }

  static Widget firstWidget() {
    return Container(
      alignment: Alignment.center,
      child: Column(
        children: <Widget>[
          CircularProgressIndicator(),
          Text("加载中...", style: TextStyle(color: Colors.grey))
        ],
      ),
    );
  }
}
